const tbody=document.querySelector('.tbody-shop')
getDate()
function getDate(){
	$.ajax({
		url:'./api/shop/getdata.php',
		method:'get',
		success:resp=>{
			if(resp.code===200){
				const {list}=resp.body
						let str='';
						list.forEach((shop,index) =>{
							str+=
							`
								<tr data-id='${shop.Id}'>
									<td>${index+1}</td>
									<td><span>${shop.name}</span><input type="text" name="" id="" class="input-name"/></td>
									<td><span>${shop.price}</span><input type="text" name="" id="" class="input-price"/></td>
									<td><span>${shop.number}</span><input type="text" name="" id="" class="input-number"/></td>
									<td>
										<button type="button" class="btn btn-info  btn-xs btn-edim">编辑</button>
										<button type="button" class="btn btn-danger  btn-xs btn-del">删除</button>
										<button type="button" class="btn btn-success  btn-xs btn-affirm">确认</button>
										<button type="button" class="btn btn-warning  btn-xs btn-cancel">取消</button>	
									</td>
								</tr>
							`
						})
		 				$('tbody').html(str)	
			}
	},
	dataType:'json'
})
// utils.fetch('./api/shop/getdata.php').then(resp =>{
// 	if(resp.code = 200){
// 		const {list}=resp.body
// 		let str='';
// 		list.forEach((shop,index) =>{
// 			str+=
// 			`
// 				<tr data-id='${shop.Id}'>
// 					<td>${index+1}</td>
// 					<td><span>${shop.name}</span><input type="text" name="" id="" class="input-name"/></td>
// 					<td><span>${shop.price}</span><input type="text" name="" id="" class="input-price"/></td>
// 					<td><span>${shop.number}</span><input type="text" name="" id="" class="input-number"/></td>
// 					<td>
// 						<button type="button" class="btn btn-info  btn-xs btn-edim">编辑</button>
// 						<button type="button" class="btn btn-danger  btn-xs btn-del">删除</button>
// 						<button type="button" class="btn btn-success  btn-xs btn-affirm">确认</button>
// 						<button type="button" class="btn btn-warning  btn-xs btn-cancel">取消</button>	
// 					</td>
// 				</tr>
// 			`
// 		})
// 		$('tbody').html(str)
// 		// tbody.innerHTML=str
// 	}
// })

}